//6.61 试编写算法，求一棵以孩子-兄弟链表表示的树的度。
#include <stdio.h>
#include <stdlib.h>
#include "E:\Desktop\data_struct\5TREE\1_bin_tree\creat.h"

int fun_6_61(tree *root)
{
    tree *p = root;
    int max = 0;
    while (p)
    {
        tree *t = p;
        int k = 0;
        while (t)
        {
            ++k;
            t = t->right;
        }
        if (k > max)
            max = k;
        p = p->left;
    }
    return max;
}

int main()
{
    /*******************code*******************/
    int n = 15;
    int a1[15] = {1,
                  2, NULL,
                  5, 3, NULL, NULL,
                  NULL, 6, NULL, 4, NULL, NULL, NULL, NULL};
    tree *root;
    CreatTree(root, a1, n, 0);
    printf("%3d", fun_6_61(root));
    /******************************************/
    printf("\n\n****************************\n");
    printf("Press Enter key to continue\n");
    getchar();
    return 0;
    /******************************************/
}
